package cn.tedu.api;

import java.math.BigDecimal;
import java.util.Scanner;

/**
 * @author: Dsi
 * @date: 2021/11/15 14:00
 * @description:
 */
public class TestBigDecimal02 {
    public static void main(String[] args) {
        f1();
        f2();
    }
    private static void f2() {
        System.out.println("输入两个数字：");
        double d1=new Scanner(System.in).nextDouble();
        double d2 = new Scanner(System.in).nextDouble();
        BigDecimal big1=new BigDecimal(d1+"");
        BigDecimal big2 = new BigDecimal(d2+"");
        BigDecimal big3;
        System.out.println("+"+(big3 = big1.add(big2)));
        System.out.println("-"+(big3 = big1.subtract(big2)));
        System.out.println("/"+(big3 = big1.divide(big2,4,BigDecimal.ROUND_HALF_UP)));
        System.out.println("*"+(big3=big1.multiply(big2)));
    }
    private static void f1() {
    }
}
